package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.dao.impl.FishClassifyDaoImpl;
import com.ysd.dao.impl.FishDetailsDaoImpl;
import com.ysd.entity.Details;
import com.ysd.entity.FishClassify;


public class productDetallServlet extends HttpServlet {
	

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//引入产品分类中的dao.impl
		FishClassifyDaoImpl fishDao = new FishClassifyDaoImpl();
		List<FishClassify> fishClassifyList = fishDao.getFish();
		request.setAttribute("fishClassifyList", fishClassifyList);
		
		
		//接受前台传来的参数,转化为int类型
		int cId = Integer.parseInt(request.getParameter("fishId"));
		FishDetailsDaoImpl FDDao = new FishDetailsDaoImpl();
		List<Details> fdDao = FDDao.getFDetails(cId);
		request.setAttribute("fdDao", fdDao);
		
		request.getRequestDispatcher("productdetails.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
